package com.cloudsigns.factorymanager2.project.fragment;

import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.cloudsigns.factorymanager2.R;
import com.cloudsigns.factorymanager2.project.activity.DispatchInformationEditActivity;

/**
 * 工程施工单 派发
 * Created by tony on 2017/12/15.
 */

public class EngineeringConstructionOrderDistributedFragment extends android.support.v4.app.Fragment implements View.OnClickListener {
    /*派单方式*/
    private ImageView img_dispath_order_mode;
    /*确认派工*/
    private TextView btn_confirm_the_dispatch;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.layout_engineering_construciton_order_distributed_fragment, container, false);

        img_dispath_order_mode = view.findViewById(R.id.img_dispath_order_mode);
        btn_confirm_the_dispatch = view.findViewById(R.id.btn_confirm_the_dispatch);

        img_dispath_order_mode.setOnClickListener(this);
        btn_confirm_the_dispatch.setOnClickListener(this);
        return view;
    }


    /**
     * 确认派工
     */
    private void confirmDispatch() {
        Toast.makeText(getActivity(), "工程施工单派发成功", Toast.LENGTH_SHORT).show();

    }

    @Override
    public void onClick(View view) {
        Intent mIntent;
        switch (view.getId()) {

            case R.id.img_dispath_order_mode:  //派单方式
                mIntent = new Intent(getActivity(), DispatchInformationEditActivity.class);
                startActivity(mIntent);
                break;
            case R.id.btn_confirm_the_dispatch:  //确认派工
                confirmDispatch();
                break;
        }
    }
}
